package org.goyo.main.domain.entity.storage;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;

import org.goyo.main.domain.entity.BaseObject;
import org.goyo.main.domain.entity.base.Supplier;

/**
 * 采购入库
 * 
 * @author chenchuan
 * 2014年11月12日
 */
@Entity
public class PurInStorage  extends BaseObject implements Serializable {

	private static final long serialVersionUID = 1L;
	//单据编号前缀
	public static final String BIZTYPE = "CGRK";
	/**
	 * 业务类型	
	 */
	@Column
	private String bizType;
	/**
	 * 客户
	 */
	@ManyToOne
	@JoinColumn(name="supplierId")
	private Supplier supplier;
	
	/**
	 * 初始化库存
	 */
	@Column
	private String isinit;
	
	/**
	 * 序列号
	 */
	@Column
	public String seqNum; 
	
	@OneToMany(fetch = FetchType.LAZY,cascade={CascadeType.ALL})
	@JoinColumn(name="parent_id")
	private List<PurInStorageEntry> entrys = new ArrayList<PurInStorageEntry>();
	public String getBizType() {
		return bizType;
	}
	public void setBizType(String bizType) {
		this.bizType = bizType;
	}

	public List<PurInStorageEntry> getEntrys() {
		return entrys;
	}
	public void setEntrys(List<PurInStorageEntry> entrys) {
		this.entrys = entrys;
	}
	public static long getSerialversionuid() {
		return serialVersionUID;
	}
	public Supplier getSupplier() {
		return supplier;
	}
	public void setSupplier(Supplier supplier) {
		if(supplier != null &&("".equals(supplier.getUuid()) || supplier.getUuid()==null))
			this.supplier = null;
		else
			this.supplier = supplier;	
	}
	public String getSeqNum() {
		return seqNum;
	}
	public void setSeqNum(String seqNum) {
		this.seqNum = seqNum;
	}
	public String getIsinit() {
		return isinit;
	}
	public void setIsinit(String isinit) {
		this.isinit = isinit;
	}
}
